#include "guiterm.hpp"

FileContextMenu::FileContextMenu(string filename, Session *session)
{
	this->filename = filename;
	this->session = session;
	
	/*QAction *copyAction = addAction("Copy to... (cp)");
	copyAction->setEnabled(false);
	
	QAction *moveAction = addAction("Move to... (mv)");
	moveAction->setEnabled(false);
	
	QAction *deleteAction = addAction("Delete (rm)");
	connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteFile()));
	
	// TODO: Replace '$EDITOR' with the actual environment variable $EDITOR
	QAction *editAction = addAction("Edit with $EDITOR");
	editAction->setEnabled(false);*/

	addAction(new FileAction("Delete (rm)", "rm "+quoteProtectString(filename),
		session, true, this));
	addAction(new FileAction("Edit with $EDITOR", "$EDITOR "+quoteProtectString(filename),
		session, false, this));
}

FileContextMenu::~FileContextMenu()
{
}

void FileContextMenu::deleteFile()
{
	string cmd = "rm -f "+filename;
	session->unconfirmedCommand(cmd);
}

